home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso
/
shareware
/
fractals
/
apfelkiste
/
apfelkiste1.3
/
source
/
apfelkiste1.3src.lzh
/
Fixpoint030.a
< prev
next >
Wrap
Text File
|
1991-06-13
|
2KB
|
87 lines
** With this file I supply 68030 fixpoint calculation. To use this
** instead of the normal 68000 function, assemble it via
** asm -m2 fixpoint030
** You then should set the 68030 option with the Options program
** and click on the "build" icon.
** The function is short enough to fit completely into the 68030
** program cache and should be *REALLY* fast.
CSECT DATA,1,,2,2
XREF _maxcol
XREF _MAXITER
CSECT TEXT,0,,1,2
XDEF _Iter_FXP
_Iter_FXP:
movem.l D3-D7,-(SP) ;save registers
move.l D1,D3 ;p = r
move.l D2,D4 ;q = i
move.w _MAXITER(A4),D0
ext.l D0
__while:
move.l D1,D6 ;calc. r²
muls.l D1,D5:D6
asl.l #8,D5 ;normalize
rol.l #8,D6
move.b D6,D5
move.l D2,D7 ;calc. i²
muls.l D2,D6:D7
asl.l #8,D6 ;normalize
rol.l #8,D7
move.b D7,D6
add.l D6,D5
;now D5 contains r²+i²
cmp.l A2,D5 ;test for upper bound
bge __done ;exceeded => end
move.l D1,D5 ;calc. x+i
add.l D2,D5
move.l D1,D6 ;calc. x-i
sub.l D2,D6
muls.l D5,D5:D6 ;calc. (x+i)*(x-i)
asl.l #8,D5 ;normalize
rol.l #8,D6
move.b D6,D5
add.l D3,D5 ;add p
;D5 now contains (x+i)(x-i)+p
muls.l D1,D6:D2 ;calc. 2xi+q
asl.l #8,D6 ;normalize
rol.l #8,D2
move.b D2,D6
add.l D6,D6 ;*2
add.l D4,D6 ;add q
;D6 now contains 2xi+q
move.l D5,D1 ;r = (x+i)(x-i)+p
move.l D6,D2 ;i = 2xi+q
dbra D0,__while ;to start of loop
moveq #0,D0 ;return 0, if MAXITER was exceeded
movem.l (SP)+,D3-D7
rts
__done:
divu.w _maxcol(A4),D0 ;return ( count % maxcol )
clr.w D0
swap D0
movem.l (SP)+,D3-D7
rts
END